/*
 * @Description: 流程模型相关接口
 * @Author: zhuoda
 * @Date: 2024-03-21
 */
import {postRequest, getRequest, putRequest, deleteRequest} from '/@/lib/axios';

export const modelApi = {
  // 查询流程模型列表
  listModel: (param) => {
    return getRequest('/flowable/model/list', param);
  },

  // 查询流程模型详细
  getModel: (modelId) => {
    return getRequest(`/flowable/model/${modelId}`);
  },

  // 新增流程模型
  addModel: (param) => {
    return postRequest('/flowable/model', param);
  },

  // 修改流程模型
  updateModel: (param) => {
    return putRequest('/flowable/model', param);
  },

  // 删除流程模型
  delModel: (modelId) => {
    return deleteRequest(`/flowable/model/${modelId}`);
  },

  // 部署流程模型
  depolyModel: (modelId) => {
    return getRequest(`/flowable/model/deploy/${modelId}`);
  },

  // 获取流程模型xml
  getModelXml: (modelId) => {
    return getRequest(`/flowable/model/getBpmnXml/${modelId}`);
  },

  // 保存(更新或插入新版本)流程模型
  saveModel: (param) => {
    return postRequest('/flowable/model/save', param);
  },

  // 查询流程模型历史列表
  historyList: (param) => {
    return getRequest('/flowable/model/historyList', param);
  },

  // 设置最新版
  latestModel: (param) => {
    return postRequest('/flowable/model/latest', param);
  }
};
